package com.anlogic.sdk.bootimage.model.options;

public class BootgenOptionHelper {
	@SuppressWarnings("unchecked")
	public static <T extends IBootgenOption> T getById(IBootgenOption[] values, String id) {
		byte b;
		int i;
		IBootgenOption[] arrayOfIBootgenOption;
		for (i = (arrayOfIBootgenOption = values).length, b = 0; b < i;) {
			IBootgenOption iBootgenOption = arrayOfIBootgenOption[b];
			if (iBootgenOption.getId().equalsIgnoreCase(id))
				return (T) iBootgenOption;
			b++;
		}
		return null;
	}

	@SuppressWarnings("unchecked")
	public static <T extends IBootgenOption> T getNonNullById(IBootgenOption[] values, String id) {
		T option = getById((T[]) values, id);
		if (option != null)
			return option;
		return (T) values[0];
	}
}
